<script setup lang="ts">
import { useRoute } from 'vue-router'

import OrderLists from './c-cpns/order-lists.vue'
import OrderDetails from './c-cpns/order-details.vue'

// 获取路由对象
const $route = useRoute()
console.log($route)
</script>
<template>
  <div class="order">
    <!-- 根据订单号id：有订单号id，展示【订单详情】；无订单号id，展示【订单列表】 -->
    <!-- 订单详情 -->
    <order-details
      v-if="$route.query.orderId"
      :id="($route.query.orderId as string)"
    ></order-details>

    <!-- 订单列表 -->
    <order-lists v-else></order-lists>
  </div>
</template>
<style scoped lang="less">
.order {
  margin: 0 20px;
}
</style>
